﻿using System.Drawing;
using Graphix.Helpers;

namespace Graphix.Elements
{
    public class Axis : SimpleAxis
    {
        public Color GridlinesColor { get; set; }

        public int GridlinesCount { get; set; }

        public bool LogScale { get; set; }

        public ValuedTextStyle Title { get; set; }

        public float Minimum { get; set; }

        public float Maximum { get; set; }

        internal AutoScale Scale { get; private set; }

        public bool OppositeDirection { get; set; }

        internal void CalculateScale()
        {
            Scale = new AutoScale(this.Minimum, this.Maximum, maxTicks: this.GridlinesCount-1);
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="Axis"/> class.
        /// </summary>
        public Axis()
        {
            this.LabelsColor = new SolidBrush(Color.Black);
            this.MajorColor = new Pen(Color.DarkGray);
            this.MinorColor = new Pen(Color.DarkGray);
            this.Minimum = float.NaN;
            this.Maximum = float.NaN;
            this.Title = new ValuedTextStyle();
            this.GridlinesCount = 11;
        }

        #region Properties
        /// <summary>
        /// Gets or sets brush used for coloring labels.
        /// </summary>
        public Brush LabelsColor { get; set; }

        /// <summary>
        /// Gets or sets the pen used for major ticks lines.
        /// </summary>
        public Pen MajorColor { get; set; }

        /// <summary>
        /// Gets or sets the pen used for minor ticks lines.
        /// </summary>
        public Pen MinorColor { get; set; }
        #endregion
    }
}
